package Huihu.src.TcpandUdp;

import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

//服务区
public class TcpServer {
    public static void main(String[] args) throws Exception {
        ServerSocket serverSocket=new ServerSocket(8899);
        Socket socket=serverSocket.accept();
        InputStream is=socket.getInputStream();
        byte [] bus=new byte[1024];
        int len;
        while ((len = is.read(bus)) != -1) {
            System.out.println(new String(bus,0,len));
        }
        is.close();
        socket.close();
    }
}
